<?
	require_once("../cBasic/950cons.php");
	$recid=$_GET['recid'];

	$output=array();

	$sQuery= "select * from contract where ContID = '".$recid."'";
	$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
	$rec=array();
	while ( $aRow = mysql_fetch_array( $rResult ) )
	{
		$rec[]=$aRow['ReqID'];
		$rec[]=$aRow['EmpID'];
		$rec[]=$aRow['SkillID'];
		$rec[]=$aRow['Payment'];
		$rec[]=$aRow['ConRegDate'];
	}
	$output['contract']=$rec;
	
	$sQuery= "select * from request where ReqID = '".$output['contract'][0]."'";
	$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
	$rec=array();
	while ( $aRow = mysql_fetch_array( $rResult ) )
	{
		$rec[]=$aRow['CustID'];
		$rec[]=$aRow['StartDate'];
		$rec[]=$aRow['EndDate'];
		$rec[]=$aRow['EmpAmount'];
		$rec[]=$aRow['ReqRegDate'];
	}
	$output['request']=$rec;
	
	$sQuery= "select * from employee where EmpID = '".$output['contract'][1]."'";
	$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
	$rec=array();
	while ( $aRow = mysql_fetch_array( $rResult ) )
	{
		$rec[]=$aRow['EmpFName'];
		$rec[]=$aRow['EmpLName'];
		$rec[]=$aRow['EmpStreet'];
		$rec[]=$aRow['EmpCity'];
		$rec[]=$aRow['EmpState'];
		$rec[]=$aRow['EmpCountry'];
		$rec[]=$aRow['EmpPhone'];
		$rec[]=$aRow['EmpMobile'];
		$rec[]=$aRow['EmpFax'];
		$rec[]=$aRow['EmpEmail'];
		$rec[]=$aRow['EmpNote'];
		$rec[]=$aRow['EmpRegDate'];
	}
	$output['employee']=$rec;
	
	$sQuery= "select * from skill where skID = '".$output['contract'][2]."'";
	$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
	$rec=array();
	while ( $aRow = mysql_fetch_array( $rResult ) )
	{
		$rec[]=$aRow['skCode'];
		$rec[]=$aRow['skName'];
	}
	$output['skill']=$rec;
	
	mysql_close($con);
	
	echo json_encode($output);
?>